<?php
namespace Admin\Controller;
use Think\Controller;
class ContributeController extends BaseController {

	public function lists($nickname='', $p=''){
		$model = D('Home/Donation');
		$data  = $model->_lists($nickname, $p);
		$amount = $model->amount();
		$this->assign('amount', $amount);
		$this->assign('data', $data);
		$this->display();
	}

	public function edit($id=''){
		if(IS_POST) {
			$post = I('post.');
			$R = D('Home/Donation')->update($post);
			if($R['e'] == -1) {
				$this->error($R['info']);
			}
			$this->success('操作成功', U('lists'));
		} else {
			$data = M('donation')->where(array('is_delete' => 1))->find($id);
			$this->assign('data', $data);
			$this->display();
		}
		
	}

    public function del($id) {
    	if(M('donation')->where(array('id' => $id))->save(array('is_delete' => -1)) === false){
    		$this->error('删除失败');
    	}
    	$this->success('操作成功');
    }



}